#pragma once

// #include "TxDNN/txdnn_common.h"

#define TXDNN_GCC_REL_PATH "Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc"


/************ below interface provided by TxDA header ************/
struct txdaStream{};
typedef struct txdaStream* txdaStream_t;

struct txdaEvent{};
typedef struct txdaEvent* txdaEvent_t;


/* defined in txdac.h */

enum TxdaResult {
    TXDA_SUCCESS = 0,
    TXDA_ERROR = 1,
    TXDA_ERROR_PARAM1 = 2,
    TXDA_ERROR_PARAM2 = 3,
    TXDA_ERROR_PARAM3 = 4,
    TXDA_DEVICE_OFFLINE = 5,
    TXDA_DEVICE_OUT_OF_MEMORY = 6,
    TXDA_DEVICE_IN_IDLE = 7,
    TXDA_DEVICE_IN_ATTACH = 8,
    TXDA_DEVICE_ATTACH_SUCCESS = 9,
    TXDA_DEVICE_ATTACH_READY = 10,
    TXDA_DEVICE_LOST_CONNECT = 11,
    TXDA_ENV_CLEAN_UP = 12,
};

typedef enum TxdaResult txdaError_t;

struct TxdaModuleStruct {};
typedef struct TxdaModuleStruct* txdaModule_t;

struct TxdaModuleSymbol {};
typedef struct TxdaModuleSymbol* txdaFunction_t;

txdaError_t txdaModuleLoad(txdaModule_t* module, const char* file_path);

txdaError_t txdaModuleUnload(txdaModule_t module);

/* load module from code object which resides in host memory; data pointer to location */
txdaError_t txdaModuleLoadData(txdaModule_t* module, const void* data);

typedef enum {
    PathSuccess=0,
    PathIncorrecPararmeters = -994,
    PathValuesNotDefined = -995,
    PathValuesTooLong = -996,
    PathFailedToGetBase = -997,
    PathLinuxRuntimeErrors = -998,
    PathErrorMAX = -999               //This should always be last value in the enumerations
} txdaPathErrors_t;

txdaPathErrors_t txdaGetInstallPath(char** path, unsigned int* path_size);

/************ End for TxDA header, should remove once TxDA ready ************/


#if TxDNN_OFFLINE_COMPILER_PATH_V280
static std::string generateCompilerPathValue(const char* relative_compiler_path);

const char* getTxdaCompilerPath();

#endif // TxDNN_OFFLINE_COMPILER_PATH_V280
